import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:wheel_of_fortune/utils/utils.dart';

class ShareWidget extends StatelessWidget {
  final callBack;
  const ShareWidget({this.callBack,Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    List svgs = ['assets/svg/line.svg',
      'assets/svg/facebook.svg',
      'assets/svg/twitter.svg',
      'assets/svg/google_plus.svg',
      'Copy\nLink',
      'Save\nPicture'];
    List<Widget> widgets = [];
    List<Widget> links = [];
    for (var i = 0; i < 4; i++) {
      widgets.add(Container(
        width: 54,
        height: 54,
        alignment: Alignment.center,
        child: InkWell(
          onTap: (){
            if (this.callBack!=null) {
              this.callBack(i);
              Navigator.of(context).pop();
            }
          },
          child: SvgPicture.asset(svgs[i],),
        ),
      ));
      if (i < 3) {
        widgets.add(Spacer());
      }
    }
    for (var i = 4; i < svgs.length; i++) {
      links.add(Container(
        width: 51,
        height: 51,
        alignment: Alignment.center,
        decoration: BoxDecoration(
          color: whiteColor,
          borderRadius: BorderRadius.all(Radius.circular(8)),
          boxShadow: [
            BoxShadow(
              color: Color.fromARGB(255, 240, 240, 240),
              offset: Offset(2.0, 2.0),
              blurRadius: 10.0,
              spreadRadius: 0.0),
            BoxShadow(color: Colors.white12, offset: Offset(1.0, 1.0)),
            BoxShadow(color: Colors.white)
          ],
        ),
        child: InkWell(
          onTap: (){
            if (this.callBack!=null) {
              this.callBack(i);
              Navigator.of(context).pop();
            }
          },
          child: Text(svgs[i],
            textAlign: TextAlign.center,
            style: TextStyle(color:Color(0xFF052a60),fontSize: 9,fontFamily: 'Avenir Next LT Pro',),
          ),),
        ),
      );
      links.add(SizedBox(width: 30,));
    }
    return Container(
      color: whiteColor,
      height: 208,
      child: Column(
        children: <Widget>[
          Padding(
            padding: EdgeInsets.fromLTRB(35, 30, 35, 20),
            child: Row(
              children: widgets,
            ),
          ),
          Container(
            color: Color(0xFFEEEEEE),
            height: 0.5,
          ),
          Padding(
            padding: EdgeInsets.fromLTRB(35, 20, 35, 5),
            child: Row(
              children: links,
            ),
          ),
        ],
      ),
    );
  }
}